#pragma once

#include <typedef.h>
//
#include <protocol.hpp>
#include <task_run.hpp>

class UdpRecver : public TaskRun
{
public:
	UdpRecver(int port);
	virtual ~UdpRecver();
	virtual void Start(void* arg = nullptr);

protected:
	virtual void Run(void* arg);

private:
	BuffFifo m_BuffFifo;
	Protocol m_Protocol;
	uint16_t m_DataSeqRecv;
	uint16_t m_DataTypeRecv;
	int m_SizeRecv;
	char* m_BuffRecv;
	uint64_t rt_prev;

	int m_Port;
	int m_Socket;
	char* m_Buff;

	struct sockaddr_in m_ServerAddr;
};